import request from '@/utils/request'

// 查询参数列表
export function listTimeShiftList(query) {
  return request({
    url: '/timeShiftApi/listTimeShiftList',
    method: 'get',
    params: query
  })
}

export function changeStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/timeShiftApi' +
      '/changeStatus',
    method: 'put',
    data: data
  })
}
//信息导出
export function insert(data) {
  return request({
      url: '/timeShiftApi/insert',
    method: 'post',
    data: data
  })
}
export function getTimeShift(id) {
  return request({
      url: '/timeShiftApi/getTimeShift/'+ id,
    method: 'get'
  })
}

export function delTimeShift(timeShiftId) {
  return request({
    url: '/timeShiftApi/' + timeShiftId,
    method: 'delete'
  })
}

export function update(data) {
  return request({
    url: '/timeShiftApi/update',
    method: 'put',
    data: data
  })
}

export function saveNumber(companyId,type,sex,number) {
  const data = {
    companyId,
    type,
    sex,
    number
  }
  return request({
    url: '/timeShiftApi/saveNumber',
    method: 'post',
    data: data
  })
}
export function upload(api, file) {
  let data = new FormData()
  file.forEach(everyFile => {
    data.append("file",everyFile.raw)
  })
  return request({
    url: api,
    method: 'post',
    data: data
  })
}
